<template>
  <div class="pagination">
    <el-pagination
      @current-change="handleCurrentChange"
      :page-size="20"
      :current-page.sync="currentIndex"
      layout="total, prev, pager, next, jumper"
      :total="$store.state.project.total"
      :background="true"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  data () {
    return {
      currentIndex: 1
    }
  },
  methods: {
    handleCurrentChange (val) {
      this.currentIndex = val
      this.$store.commit('project/set_projectsearchDTO_index', val)
      this.$store.dispatch('project/getList')
    }
  },
  mounted () {
    this.$store.commit('project/set_projectId', '')
    this.handleCurrentChange(this.currentIndex)
  }
}
</script>

<style scoped lang="scss">
.pagination {
  position: relative;
  .el-pagination {
    position: absolute;
    right: 0;
    margin-bottom: 30px;
  }
}
</style>
